"""incident fingerprint

Revision ID: 620b6c048091
Revises: 895fe80117aa
Create Date: 2024-11-10 13:06:09.620665

"""

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "620b6c048091"
down_revision = "895fe80117aa"
branch_labels = None
depends_on = None


def is_postgres():
    """Check if we're running on PostgreSQL"""
    bind = op.get_bind()
    return bind.engine.name == "postgresql"


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("incident", schema=None) as batch_op:
        batch_op.add_column(
            sa.Column(
                "fingerprint",
                sa.TEXT(length=36) if not is_postgres() else sa.TEXT(),
                nullable=True,
            )
        )
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("incident", schema=None) as batch_op:
        batch_op.drop_column("fingerprint")
    # ### end Alembic commands ###
